package com.shujia.interfacer;

import com.shujia.reflect.DataRead;
import com.shujia.reflect.Score;
import com.shujia.reflect.Student;

import java.util.ArrayList;

public class Demo3Student {
    public static void main(String[] args) {

        ArrayList<Student> students = DataRead.read("java/data/students.txt", Student.class);

        ArrayList<Score> scores = DataRead.read("java/data/score.txt", Score.class);

        //取出新别为男的学生

        DataSet<Student> dataSet = new DataSet<Student>(students);

        dataSet.filter(new FilterFunaction<Student>() {
            @Override
            public Boolean filter(Student i) {
                return i.getGender().equals("男");
            }
        }).map(new Funcation<Student, String>() {
            @Override
            public String map(Student i) {
                return i.getId() + "," + i.getName() + "," + i.getAge() + "." + i.getGender() + "," + i.getClazz();
            }
        }).save("java/data/nan.txt");

    }
}
